﻿<src:ApplicationWindow x:Class="WpfAppHost.MainAppWindow"
    xmlns:src="clr-namespace:WpfAppHost"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MEF Utility Runner" Height="372" Width="511" ShowTrayIcon="True" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Icon="/HostedWpfApp;component/Gear.ico">
	<src:ApplicationWindow.Resources>
		<DataTemplate x:Key="AddinListTemplate">
            <Border BorderThickness="2" BorderBrush="BurlyWood" CornerRadius="4" HorizontalAlignment="Stretch">
			<StackPanel HorizontalAlignment="Stretch">
				<Image Width="48" Height="48" Source="{Binding AddinIconUri}"/>
				<TextBlock Text="{Binding Path=Name}" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Stretch" FontWeight="Bold" FontSize="12"/>
			</StackPanel></Border>
		</DataTemplate>
		<ItemsPanelTemplate x:Key="AddinsListBoxTemplate">
			<StackPanel/>
		</ItemsPanelTemplate>
	</src:ApplicationWindow.Resources>

	<Grid Width="Auto" Height="Auto">
		<Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.2*"/>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="0.8*"/>
		</Grid.ColumnDefinitions>

		<ListBox HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Addins}" x:Name="addinListBox" ItemTemplate="{DynamicResource AddinListTemplate}" ItemsPanel="{DynamicResource AddinsListBoxTemplate}" />
        <GridSplitter Grid.Column="1" Grid.Row="0" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
        <DockPanel DataContext="{Binding Path=SelectedItem, ElementName=addinListBox, Mode=Default}" x:Name="dockPanelAddinInfo" Grid.Column="2" Grid.ColumnSpan="1" Grid.Row="0" d:LayoutOverrides="Height" LastChildFill="True">
        	<!--Expander Header="About this Application" x:Name="aboutExpander" DockPanel.Dock="Top">
        		<Border CornerRadius="3" BorderBrush="DarkBlue" BorderThickness="3" Margin="5" Padding="5">
        			<Grid x:Name="stackPanelAddinDetails">
        				<Grid.ColumnDefinitions>
        					<ColumnDefinition Width="*" />
        					<ColumnDefinition Width="*" />
        				</Grid.ColumnDefinitions>
        				<Grid.RowDefinitions>
        					<RowDefinition Height="*" />
        					<RowDefinition Height="*" />
        				</Grid.RowDefinitions>
        				<TextBlock Padding="2" FontWeight="Bold" Text="{Binding Path=Name}"  />
        				<TextBlock Padding="2" Text="{Binding Path=Version}" Grid.Column="1" />
        				<TextBlock Padding="2" Text="{Binding Path=Description}" TextWrapping="Wrap" Grid.Row="1" />
        				<TextBlock Padding="2" Text="{Binding Path=Author}" Grid.Row="1" Grid.Column="1" />
        			</Grid>
        		</Border>
        	</Expander-->
        	<Border x:Name="SettingsControlRegion" CornerRadius="3" BorderBrush="DarkBlue" DockPanel.Dock="Bottom" BorderThickness="3" Padding="5">
        		<ContentControl x:Name="SettingsControl" Content="{Binding Path=OptionsUserControl}" />
        	</Border>
        </DockPanel>
	</Grid>
</src:ApplicationWindow>
